package cn.stylefeng.guns.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName ImageUploadConfig
 * @Author zangshuaihu
 * @Date 2022/7/27
 * @Version 1.0
 **/
@Slf4j
@Configuration
public class ImageUploadConfig implements WebMvcConfigurer {

    @Value("${guns.resource}")
    private String resource;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        log.info("图片映射路径地址:{}",resource);
        registry.addResourceHandler("/assets/img/**").addResourceLocations(resource);
    }
}
